<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
	
</script>
<script>
	$(document).ready(function() {
		$("#form").click(function() {
			$.ajax({
				type : 'post',
				url : 'http://localhost:8081/cors/form',
				contentType : 'application/x-www-form-urlencoded',
				data : {
					name : "margo",
					age : 27
				},
				dataType : 'json',
				success : function(data) {

				}
			})
		});
		$("#json").click(function() {
			var data = {
				name : "margo",
				age : 27
			}
			$.ajax({
				type : 'post',
				url : 'http://localhost:8081/cors/json',
				contentType : 'application/json',
				data : JSON.stringify(data),
				dataType : 'json',
				success : function(data) {

				}
			})
		});
	});
</script>
</head>
<body>
	<p id="form">发送ajax form提交</p>
	<p id="json">发送ajax json</p>
</body>
</html>